/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package behaviourdiagram.impl;

import behaviourdiagram.BehaviourState;
import behaviourdiagram.BehaviourdiagramPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Behaviour State</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link behaviourdiagram.impl.BehaviourStateImpl#isActive <em>Active</em>}</li>
 *   <li>{@link behaviourdiagram.impl.BehaviourStateImpl#isFinished <em>Finished</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BehaviourStateImpl extends EObjectImpl implements BehaviourState {
	/**
   * The default value of the '{@link #isActive() <em>Active</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #isActive()
   * @generated
   * @ordered
   */
	protected static final boolean ACTIVE_EDEFAULT = false;

	/**
   * The cached value of the '{@link #isActive() <em>Active</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #isActive()
   * @generated
   * @ordered
   */
	protected boolean active = ACTIVE_EDEFAULT;

	/**
   * The default value of the '{@link #isFinished() <em>Finished</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #isFinished()
   * @generated
   * @ordered
   */
	protected static final boolean FINISHED_EDEFAULT = false;

	/**
   * The cached value of the '{@link #isFinished() <em>Finished</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #isFinished()
   * @generated
   * @ordered
   */
	protected boolean finished = FINISHED_EDEFAULT;

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	protected BehaviourStateImpl() {
    super();
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	protected EClass eStaticClass() {
    return BehaviourdiagramPackage.Literals.BEHAVIOUR_STATE;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public boolean isActive() {
    return active;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setActive(boolean newActive) {
    boolean oldActive = active;
    active = newActive;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BehaviourdiagramPackage.BEHAVIOUR_STATE__ACTIVE, oldActive, active));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public boolean isFinished() {
    return finished;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setFinished(boolean newFinished) {
    boolean oldFinished = finished;
    finished = newFinished;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BehaviourdiagramPackage.BEHAVIOUR_STATE__FINISHED, oldFinished, finished));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void getState() {
    // TODO: implement this method
    // Ensure that you remove @generated or mark it @generated NOT
    throw new UnsupportedOperationException();
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public boolean setState() {
    // TODO: implement this method
    // Ensure that you remove @generated or mark it @generated NOT
    throw new UnsupportedOperationException();
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__ACTIVE:
        return isActive();
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__FINISHED:
        return isFinished();
    }
    return super.eGet(featureID, resolve, coreType);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public void eSet(int featureID, Object newValue) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__ACTIVE:
        setActive((Boolean)newValue);
        return;
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__FINISHED:
        setFinished((Boolean)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public void eUnset(int featureID) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__ACTIVE:
        setActive(ACTIVE_EDEFAULT);
        return;
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__FINISHED:
        setFinished(FINISHED_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public boolean eIsSet(int featureID) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__ACTIVE:
        return active != ACTIVE_EDEFAULT;
      case BehaviourdiagramPackage.BEHAVIOUR_STATE__FINISHED:
        return finished != FINISHED_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public String toString() {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (active: ");
    result.append(active);
    result.append(", finished: ");
    result.append(finished);
    result.append(')');
    return result.toString();
  }

} //BehaviourStateImpl
